<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>


    
    <h1>兼容 ie </h1>
    <h1>   无缝轮播   </h1>

    
    <style>
        * {
            padding: 0;
            margin: 0;
            box-sizing: border-box;
        }

        ul,
        li {
            list-style: none;
        }

        img {
            vertical-align: top;
        }

        #box {
            width: 200px;
            height: 100px;
            margin: 100px auto;
            background-color: pink;
            position: relative;
            /* overflow: hidden; */
            border: 5px solid red;
        }

        #box ul {
            width: 1200px;
            position: absolute;
            background-color: lightgray;
            left: 0;
            top: 0;
        }

        #box li {
            float: left;
            width: 200px;
            height: 100px;
        }

        .li-1 {
            background-color: #f6e659;
        }

        .li-2 {
            background-color: #57fa4f;
        }

        .li-3 {
            background-color: #3a8ef1;
        }
    </style>
    <div id="box">
        <ul>
            <li class="li-1 ">one</li>
            <li class="li-2 ">two</li>
            <li class="li-3 ">three</li>
            <li class="li-1 ">one-1</li>
        </ul>
    </div>


<xmp style="font-size: 22px; font-weight: bolder;  margin-bottom: 66px;  color: black;  font-family: '微软雅黑';">   

    #box ul {
        width: 2000px;        => 父容器设置足够宽的宽度, 为了能容下子元素横向排列
        position: absolute;
        background-color: lightgray;
        left: 0;
        top: 0;
    }

    #box li {
        float: left;            => 子元素设置浮动, 这样就横向排列了
        width: 200px;
        height: 100px;
    }

    var box = document.getElementById("box");
    var ul = box.children[0];
    var num = 0;
    timer = setInterval(startttt, 10);    => 每 10 毫秒向左移动移动 1 像素
    function startttt() {
        num--;
        num <= -600 ? num = 0 : num;
        ul.style.left = num + "px";
    }


    #box {
        width: 200px;
        height: 100px;
        margin: 100px auto;
        background-color: pink;
        position: relative;
        /* overflow: hidden; */             => 最后 将外面的隐藏掉
        border: 5px solid red;
    }


</xmp>

<script>
    var box = document.getElementById("box");
    var ul = box.children[0];
    var num = 0;
    timer = setInterval(startttt, 10);
    function startttt() {
        num--;
        num <= -600 ? num = 0 : num;
        ul.style.left = num + "px";
    }
</script>
    
</body>
</html>